package com.situ.springboot.controller;

import com.situ.springboot.service.IUserService;
import com.situ.springboot.vo.DeptCount;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
@RequestMapping("/echarts")
public class EChartsController {
    @Autowired
    private IUserService userService;

    @RequestMapping("/toECharts")
    public String toECharts() {
        return "echarts";
    }

    @RequestMapping("/data")
    @ResponseBody
    public List<DeptCount> data() {
        // { value: 3, name: 'IT部' }
        List<DeptCount> list = userService.selectDeptCount();
        return list;
    }
}
